3.1.72 \(\int \frac {(a+b \tan (e+f x)) (A+B \tan (e+f x)+C \tan ^2(e+f x))}{c+d \tan (e+f x)} \, dx\) [72]

Optimal. Leaf size=156 \[ \frac {(a (A c-c C+B d)-b (B c-(A-C) d)) x}{c^2+d^2}-\frac {(A b c+a B c-b c C-a A d+b B d+a C d) \log (\cos (e+f x))}{\left (c^2+d^2\right ) f}-\frac {(b c-a d) \left (c^2 C-B c d+A d^2\right ) \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right ) f}+\frac {b C \tan (e+f x)}{d f} \]

[Out]

(a*(A*c+B*d-C*c)-b*(B*c-(A-C)*d))*x/(c^2+d^2)-(-A*a*d+A*b*c+B*a*c+B*b*d+C*a*d-C*b*c)*ln(cos(f*x+e))/(c^2+d^2)/
f-(-a*d+b*c)*(A*d^2-B*c*d+C*c^2)*ln(c+d*tan(f*x+e))/d^2/(c^2+d^2)/f+b*C*tan(f*x+e)/d/f

________________________________________________________________________________________

Rubi [A]
time = 0.23, antiderivative size = 156, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 43, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.116, Rules used = {3718, 3707, 3698, 31, 3556} \begin {gather*} -\frac {(b c-a d) \left (A d^2-B c d+c^2 C\right ) \log (c+d \tan (e+f x))}{d^2 f \left (c^2+d^2\right )}-\frac {\log (\cos (e+f x)) (-a A d+a B c+a C d+A b c+b B d-b c C)}{f \left (c^2+d^2\right )}+\frac {x (a (A c+B d-c C)-b (B c-d (A-C)))}{c^2+d^2}+\frac {b C \tan (e+f x)}{d f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((a + b*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x]),x]

[Out]

((a*(A*c - c*C + B*d) - b*(B*c - (A - C)*d))*x)/(c^2 + d^2) - ((A*b*c + a*B*c - b*c*C - a*A*d + b*B*d + a*C*d)
*Log[Cos[e + f*x]])/((c^2 + d^2)*f) - ((b*c - a*d)*(c^2*C - B*c*d + A*d^2)*Log[c + d*Tan[e + f*x]])/(d^2*(c^2
+ d^2)*f) + (b*C*Tan[e + f*x])/(d*f)

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3698

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[
A/(b*f), Subst[Int[(a + x)^m, x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]

Rule 3707

Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2)/((a_.) + (b_.)*tan[(e_.) + (f_.)*
(x_)]), x_Symbol] :> Simp[(a*A + b*B - a*C)*(x/(a^2 + b^2)), x] + (Dist[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2), I
nt[(1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Dist[(A*b - a*B - b*C)/(a^2 + b^2), Int[Tan[e + f*x], x
], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a
*B - b*C, 0]

Rule 3718

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e
_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[b*C*Tan[e + f*x]*((c + d*Tan[e + f*x])
^(n + 1)/(d*f*(n + 2))), x] - Dist[1/(d*(n + 2)), Int[(c + d*Tan[e + f*x])^n*Simp[b*c*C - a*A*d*(n + 2) - (A*b
 + a*B - b*C)*d*(n + 2)*Tan[e + f*x] - (a*C*d*(n + 2) - b*(c*C - B*d*(n + 2)))*Tan[e + f*x]^2, x], x], x] /; F
reeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] &&  !LtQ[n, -1]

Rubi steps

\begin {align*} \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{c+d \tan (e+f x)} \, dx &=\frac {b C \tan (e+f x)}{d f}-\frac {\int \frac {b c C-a A d-(A b+a B-b C) d \tan (e+f x)+(b c C-b B d-a C d) \tan ^2(e+f x)}{c+d \tan (e+f x)} \, dx}{d}\\ &=\frac {(a (A c-c C+B d)-b (B c-(A-C) d)) x}{c^2+d^2}+\frac {b C \tan (e+f x)}{d f}+\frac {(A b c+a B c-b c C-a A d+b B d+a C d) \int \tan (e+f x) \, dx}{c^2+d^2}-\frac {\left ((b c-a d) \left (c^2 C-B c d+A d^2\right )\right ) \int \frac {1+\tan ^2(e+f x)}{c+d \tan (e+f x)} \, dx}{d \left (c^2+d^2\right )}\\ &=\frac {(a (A c-c C+B d)-b (B c-(A-C) d)) x}{c^2+d^2}-\frac {(A b c+a B c-b c C-a A d+b B d+a C d) \log (\cos (e+f x))}{\left (c^2+d^2\right ) f}+\frac {b C \tan (e+f x)}{d f}-\frac {\left ((b c-a d) \left (c^2 C-B c d+A d^2\right )\right ) \text {Subst}\left (\int \frac {1}{c+x} \, dx,x,d \tan (e+f x)\right )}{d^2 \left (c^2+d^2\right ) f}\\ &=\frac {(a (A c-c C+B d)-b (B c-(A-C) d)) x}{c^2+d^2}-\frac {(A b c+a B c-b c C-a A d+b B d+a C d) \log (\cos (e+f x))}{\left (c^2+d^2\right ) f}-\frac {(b c-a d) \left (c^2 C-B c d+A d^2\right ) \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right ) f}+\frac {b C \tan (e+f x)}{d f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains complex when optimal does not.
time = 0.72, size = 148, normalized size = 0.95 \begin {gather*} \frac {\frac {(-i a+b) (A+i B-C) \log (i-\tan (e+f x))}{c+i d}+\frac {(i a+b) (A-i B-C) \log (i+\tan (e+f x))}{c-i d}+\frac {2 (-b c+a d) \left (c^2 C-B c d+A d^2\right ) \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right )}+\frac {2 b C \tan (e+f x)}{d}}{2 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[((a + b*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x]),x]

[Out]

((((-I)*a + b)*(A + I*B - C)*Log[I - Tan[e + f*x]])/(c + I*d) + ((I*a + b)*(A - I*B - C)*Log[I + Tan[e + f*x]]
)/(c - I*d) + (2*(-(b*c) + a*d)*(c^2*C - B*c*d + A*d^2)*Log[c + d*Tan[e + f*x]])/(d^2*(c^2 + d^2)) + (2*b*C*Ta
n[e + f*x])/d)/(2*f)

________________________________________________________________________________________

Maple [A]
time = 0.22, size = 173, normalized size = 1.11

method result size
derivativedivides \(\frac {\frac {C b \tan \left (f x +e \right )}{d}+\frac {\left (A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} \left (c^{2}+d^{2}\right )}+\frac {\frac {\left (-A a d +A b c +B a c +B b d +a C d -C b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (A a c +A b d +B a d -B b c -C a c -C b d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}}{f}\) \(173\)
default \(\frac {\frac {C b \tan \left (f x +e \right )}{d}+\frac {\left (A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} \left (c^{2}+d^{2}\right )}+\frac {\frac {\left (-A a d +A b c +B a c +B b d +a C d -C b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (A a c +A b d +B a d -B b c -C a c -C b d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}}{f}\) \(173\)
norman \(\frac {\left (A a c +A b d +B a d -B b c -C a c -C b d \right ) x}{c^{2}+d^{2}}+\frac {b C \tan \left (f x +e \right )}{d f}+\frac {\left (A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} f \left (c^{2}+d^{2}\right )}-\frac {\left (A a d -A b c -B a c -B b d -a C d +C b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 \left (c^{2}+d^{2}\right ) f}\) \(181\)
risch \(-\frac {2 i B b \,c^{2} e}{d f \left (c^{2}+d^{2}\right )}-\frac {2 i C a \,c^{2} e}{d f \left (c^{2}+d^{2}\right )}+\frac {2 i C b \,c^{3} e}{d^{2} f \left (c^{2}+d^{2}\right )}-\frac {2 i d A a e}{f \left (c^{2}+d^{2}\right )}+\frac {2 i A b c e}{f \left (c^{2}+d^{2}\right )}+\frac {2 i B a c e}{f \left (c^{2}+d^{2}\right )}-\frac {2 i B b \,c^{2} x}{d \left (c^{2}+d^{2}\right )}-\frac {2 i C a \,c^{2} x}{d \left (c^{2}+d^{2}\right )}+\frac {2 i C b \,c^{3} x}{d^{2} \left (c^{2}+d^{2}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) B b \,c^{2}}{d f \left (c^{2}+d^{2}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) C a \,c^{2}}{d f \left (c^{2}+d^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) C b \,c^{3}}{d^{2} f \left (c^{2}+d^{2}\right )}-\frac {2 i C b c e}{d^{2} f}+\frac {2 i a C x}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a C}{d f}+\frac {i x A b}{i d -c}+\frac {i x a B}{i d -c}-\frac {i x C b}{i d -c}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B b}{d f}+\frac {2 i B b x}{d}-\frac {x a A}{i d -c}+\frac {x B b}{i d -c}+\frac {x C a}{i d -c}-\frac {2 i C b c x}{d^{2}}-\frac {2 i d A a x}{c^{2}+d^{2}}+\frac {2 i A b c x}{c^{2}+d^{2}}+\frac {2 i B a c x}{c^{2}+d^{2}}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) C b c}{d^{2} f}+\frac {d \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) A a}{f \left (c^{2}+d^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) A b c}{f \left (c^{2}+d^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) B a c}{f \left (c^{2}+d^{2}\right )}+\frac {2 i C b}{f d \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {2 i B b e}{d f}+\frac {2 i a C e}{d f}\) \(776\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*(C*b/d*tan(f*x+e)+1/d^2*(A*a*d^3-A*b*c*d^2-B*a*c*d^2+B*b*c^2*d+C*a*c^2*d-C*b*c^3)/(c^2+d^2)*ln(c+d*tan(f*x
+e))+1/(c^2+d^2)*(1/2*(-A*a*d+A*b*c+B*a*c+B*b*d+C*a*d-C*b*c)*ln(1+tan(f*x+e)^2)+(A*a*c+A*b*d+B*a*d-B*b*c-C*a*c
-C*b*d)*arctan(tan(f*x+e))))

________________________________________________________________________________________

Maxima [A]
time = 0.55, size = 182, normalized size = 1.17 \begin {gather*} \frac {\frac {2 \, C b \tan \left (f x + e\right )}{d} + \frac {2 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c + {\left (B a + {\left (A - C\right )} b\right )} d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} - \frac {2 \, {\left (C b c^{3} - A a d^{3} - {\left (C a + B b\right )} c^{2} d + {\left (B a + A b\right )} c d^{2}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} d^{2} + d^{4}} + \frac {{\left ({\left (B a + {\left (A - C\right )} b\right )} c - {\left ({\left (A - C\right )} a - B b\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

1/2*(2*C*b*tan(f*x + e)/d + 2*(((A - C)*a - B*b)*c + (B*a + (A - C)*b)*d)*(f*x + e)/(c^2 + d^2) - 2*(C*b*c^3 -
 A*a*d^3 - (C*a + B*b)*c^2*d + (B*a + A*b)*c*d^2)*log(d*tan(f*x + e) + c)/(c^2*d^2 + d^4) + ((B*a + (A - C)*b)
*c - ((A - C)*a - B*b)*d)*log(tan(f*x + e)^2 + 1)/(c^2 + d^2))/f

________________________________________________________________________________________

Fricas [A]
time = 3.88, size = 217, normalized size = 1.39 \begin {gather*} \frac {2 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c d^{2} + {\left (B a + {\left (A - C\right )} b\right )} d^{3}\right )} f x - {\left (C b c^{3} - A a d^{3} - {\left (C a + B b\right )} c^{2} d + {\left (B a + A b\right )} c d^{2}\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) + {\left (C b c^{3} + C b c d^{2} - {\left (C a + B b\right )} c^{2} d - {\left (C a + B b\right )} d^{3}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (C b c^{2} d + C b d^{3}\right )} \tan \left (f x + e\right )}{2 \, {\left (c^{2} d^{2} + d^{4}\right )} f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/2*(2*(((A - C)*a - B*b)*c*d^2 + (B*a + (A - C)*b)*d^3)*f*x - (C*b*c^3 - A*a*d^3 - (C*a + B*b)*c^2*d + (B*a +
 A*b)*c*d^2)*log((d^2*tan(f*x + e)^2 + 2*c*d*tan(f*x + e) + c^2)/(tan(f*x + e)^2 + 1)) + (C*b*c^3 + C*b*c*d^2
- (C*a + B*b)*c^2*d - (C*a + B*b)*d^3)*log(1/(tan(f*x + e)^2 + 1)) + 2*(C*b*c^2*d + C*b*d^3)*tan(f*x + e))/((c
^2*d^2 + d^4)*f)

________________________________________________________________________________________

Sympy [C] Result contains complex when optimal does not.
time = 1.02, size = 2387, normalized size = 15.30 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)**2)/(c+d*tan(f*x+e)),x)

[Out]

Piecewise((zoo*x*(a + b*tan(e))*(A + B*tan(e) + C*tan(e)**2)/tan(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), (I*A*a*f
*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) + A*a*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*A*a/(2*d*f*tan(e +
 f*x) - 2*I*d*f) + A*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*A*b*f*x/(2*d*f*tan(e + f*x) - 2*I*d
*f) - A*b/(2*d*f*tan(e + f*x) - 2*I*d*f) + B*a*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*B*a*f*x/(2*
d*f*tan(e + f*x) - 2*I*d*f) - B*a/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*B*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x)
- 2*I*d*f) + B*b*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + B*b*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e +
 f*x) - 2*I*d*f) - I*B*b*log(tan(e + f*x)**2 + 1)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*B*b/(2*d*f*tan(e + f*x) -
 2*I*d*f) + I*C*a*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) + C*a*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + C
*a*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*C*a*log(tan(e + f*x)**2 + 1)/(2*d*
f*tan(e + f*x) - 2*I*d*f) - I*C*a/(2*d*f*tan(e + f*x) - 2*I*d*f) - 3*C*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x)
- 2*I*d*f) + 3*I*C*b*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*C*b*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*d*f*t
an(e + f*x) - 2*I*d*f) + C*b*log(tan(e + f*x)**2 + 1)/(2*d*f*tan(e + f*x) - 2*I*d*f) + 2*C*b*tan(e + f*x)**2/(
2*d*f*tan(e + f*x) - 2*I*d*f) + 3*C*b/(2*d*f*tan(e + f*x) - 2*I*d*f), Eq(c, -I*d)), (-I*A*a*f*x*tan(e + f*x)/(
2*d*f*tan(e + f*x) + 2*I*d*f) + A*a*f*x/(2*d*f*tan(e + f*x) + 2*I*d*f) - I*A*a/(2*d*f*tan(e + f*x) + 2*I*d*f)
+ A*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + I*A*b*f*x/(2*d*f*tan(e + f*x) + 2*I*d*f) - A*b/(2*d*f*
tan(e + f*x) + 2*I*d*f) + B*a*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + I*B*a*f*x/(2*d*f*tan(e + f*x)
+ 2*I*d*f) - B*a/(2*d*f*tan(e + f*x) + 2*I*d*f) - I*B*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + B*b*
f*x/(2*d*f*tan(e + f*x) + 2*I*d*f) + B*b*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f)
+ I*B*b*log(tan(e + f*x)**2 + 1)/(2*d*f*tan(e + f*x) + 2*I*d*f) + I*B*b/(2*d*f*tan(e + f*x) + 2*I*d*f) - I*C*a
*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + C*a*f*x/(2*d*f*tan(e + f*x) + 2*I*d*f) + C*a*log(tan(e + f*
x)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + I*C*a*log(tan(e + f*x)**2 + 1)/(2*d*f*tan(e + f*x) +
2*I*d*f) + I*C*a/(2*d*f*tan(e + f*x) + 2*I*d*f) - 3*C*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) - 3*I*
C*b*f*x/(2*d*f*tan(e + f*x) + 2*I*d*f) - I*C*b*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I
*d*f) + C*b*log(tan(e + f*x)**2 + 1)/(2*d*f*tan(e + f*x) + 2*I*d*f) + 2*C*b*tan(e + f*x)**2/(2*d*f*tan(e + f*x
) + 2*I*d*f) + 3*C*b/(2*d*f*tan(e + f*x) + 2*I*d*f), Eq(c, I*d)), ((A*a*x + A*b*log(tan(e + f*x)**2 + 1)/(2*f)
 + B*a*log(tan(e + f*x)**2 + 1)/(2*f) - B*b*x + B*b*tan(e + f*x)/f - C*a*x + C*a*tan(e + f*x)/f - C*b*log(tan(
e + f*x)**2 + 1)/(2*f) + C*b*tan(e + f*x)**2/(2*f))/c, Eq(d, 0)), (x*(a + b*tan(e))*(A + B*tan(e) + C*tan(e)**
2)/(c + d*tan(e)), Eq(f, 0)), (2*A*a*c*d**2*f*x/(2*c**2*d**2*f + 2*d**4*f) + 2*A*a*d**3*log(c/d + tan(e + f*x)
)/(2*c**2*d**2*f + 2*d**4*f) - A*a*d**3*log(tan(e + f*x)**2 + 1)/(2*c**2*d**2*f + 2*d**4*f) - 2*A*b*c*d**2*log
(c/d + tan(e + f*x))/(2*c**2*d**2*f + 2*d**4*f) + A*b*c*d**2*log(tan(e + f*x)**2 + 1)/(2*c**2*d**2*f + 2*d**4*
f) + 2*A*b*d**3*f*x/(2*c**2*d**2*f + 2*d**4*f) - 2*B*a*c*d**2*log(c/d + tan(e + f*x))/(2*c**2*d**2*f + 2*d**4*
f) + B*a*c*d**2*log(tan(e + f*x)**2 + 1)/(2*c**2*d**2*f + 2*d**4*f) + 2*B*a*d**3*f*x/(2*c**2*d**2*f + 2*d**4*f
) + 2*B*b*c**2*d*log(c/d + tan(e + f*x))/(2*c**2*d**2*f + 2*d**4*f) - 2*B*b*c*d**2*f*x/(2*c**2*d**2*f + 2*d**4
*f) + B*b*d**3*log(tan(e + f*x)**2 + 1)/(2*c**2*d**2*f + 2*d**4*f) + 2*C*a*c**2*d*log(c/d + tan(e + f*x))/(2*c
**2*d**2*f + 2*d**4*f) - 2*C*a*c*d**2*f*x/(2*c**2*d**2*f + 2*d**4*f) + C*a*d**3*log(tan(e + f*x)**2 + 1)/(2*c*
*2*d**2*f + 2*d**4*f) - 2*C*b*c**3*log(c/d + tan(e + f*x))/(2*c**2*d**2*f + 2*d**4*f) + 2*C*b*c**2*d*tan(e + f
*x)/(2*c**2*d**2*f + 2*d**4*f) - C*b*c*d**2*log(tan(e + f*x)**2 + 1)/(2*c**2*d**2*f + 2*d**4*f) - 2*C*b*d**3*f
*x/(2*c**2*d**2*f + 2*d**4*f) + 2*C*b*d**3*tan(e + f*x)/(2*c**2*d**2*f + 2*d**4*f), True))

________________________________________________________________________________________

Giac [A]
time = 0.71, size = 186, normalized size = 1.19 \begin {gather*} \frac {\frac {2 \, C b \tan \left (f x + e\right )}{d} + \frac {2 \, {\left (A a c - C a c - B b c + B a d + A b d - C b d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} + \frac {{\left (B a c + A b c - C b c - A a d + C a d + B b d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}} - \frac {2 \, {\left (C b c^{3} - C a c^{2} d - B b c^{2} d + B a c d^{2} + A b c d^{2} - A a d^{3}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{2} d^{2} + d^{4}}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

1/2*(2*C*b*tan(f*x + e)/d + 2*(A*a*c - C*a*c - B*b*c + B*a*d + A*b*d - C*b*d)*(f*x + e)/(c^2 + d^2) + (B*a*c +
 A*b*c - C*b*c - A*a*d + C*a*d + B*b*d)*log(tan(f*x + e)^2 + 1)/(c^2 + d^2) - 2*(C*b*c^3 - C*a*c^2*d - B*b*c^2
*d + B*a*c*d^2 + A*b*c*d^2 - A*a*d^3)*log(abs(d*tan(f*x + e) + c))/(c^2*d^2 + d^4))/f

________________________________________________________________________________________

Mupad [B]
time = 10.25, size = 186, normalized size = 1.19 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (A\,b+B\,a-C\,b-A\,a\,1{}\mathrm {i}+B\,b\,1{}\mathrm {i}+C\,a\,1{}\mathrm {i}\right )}{2\,f\,\left (c+d\,1{}\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (B\,b+A\,b\,1{}\mathrm {i}+B\,a\,1{}\mathrm {i}-A\,a+C\,a-C\,b\,1{}\mathrm {i}\right )}{2\,f\,\left (d+c\,1{}\mathrm {i}\right )}-\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (d^2\,\left (A\,b\,c+B\,a\,c\right )-d\,\left (B\,b\,c^2+C\,a\,c^2\right )-A\,a\,d^3+C\,b\,c^3\right )}{f\,\left (c^2\,d^2+d^4\right )}+\frac {C\,b\,\mathrm {tan}\left (e+f\,x\right )}{d\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((a + b*tan(e + f*x))*(A + B*tan(e + f*x) + C*tan(e + f*x)^2))/(c + d*tan(e + f*x)),x)

[Out]

(log(tan(e + f*x) - 1i)*(A*b - A*a*1i + B*a + B*b*1i + C*a*1i - C*b))/(2*f*(c + d*1i)) + (log(tan(e + f*x) + 1
i)*(A*b*1i - A*a + B*a*1i + B*b + C*a - C*b*1i))/(2*f*(c*1i + d)) - (log(c + d*tan(e + f*x))*(d^2*(A*b*c + B*a
*c) - d*(B*b*c^2 + C*a*c^2) - A*a*d^3 + C*b*c^3))/(f*(d^4 + c^2*d^2)) + (C*b*tan(e + f*x))/(d*f)

________________________________________________________________________________________